import 'package:flutter/material.dart';
import 'package:uikit/uikit.dart';

import '../../model/section_model.dart';

class POIFooter extends StatelessWidget {
  final POIListSectionFooterModel footModel;
  final ValueChanged<POIFooterType> callback;
  final bool noCorners;

  const POIFooter({
    Key? key,
    required this.footModel,
    this.noCorners = false,
    required this.callback,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return SliverToBoxAdapter(
        child: T3GestureDetector(
          onTap: () {
            callback(footModel.type);
          },
          child: Container(
            height: 52,
            decoration: BoxDecoration(
                color: Colors.white,
                borderRadius: noCorners ? null : const BorderRadius.only(
                    bottomRight: Radius.circular(24),
                    bottomLeft: Radius.circular(24)
                )
            ),
            child: Row(
              children: [
                const SizedBox(width: 12,),
                if (footModel.imageName != null)
                  ...[
                    T3Image.t3assets(footModel.imageName!),
                    const SizedBox(width: 8,),
                  ],

                Text(
                  footModel.title,
                  style: const TextStyle(
                      color: LucyColors.lucy_02102A,
                      fontSize: 14,
                      fontWeight: LucyFonts.semi_bold
                  ),
                ),
                const Expanded(child: SizedBox()),
                T3Image.t3assets(T3AssetsName.icon_right),
                const SizedBox(width: 12,),
              ],
            ),
          ),
        )
    );
  }
}
